package CalendarComponents;

import Managers.CalendarManager;
import Managers.Category;
import Managers.Day;

@SuppressWarnings("serial")
public class SmallDayView extends DayView
{
	private int MemberOfMonth;
	private int MonthNumber;
	private boolean  leapday = false;
	public SmallDayView(Day day, int n, int monthNo)
	{
		super(day, 143, 150);
		MemberOfMonth = n;
		MonthNumber = monthNo;
		if(MonthNumber == 12)
		{
			System.out.println("day: " + day + " month No: " + monthNo + " day No: " + n);
		}
	}
	
	public SmallDayView(Day day, int n, int monthNo, boolean extra)
	{
		super(day, 143, 150);
		leapday = extra;
		MemberOfMonth = n;
		MonthNumber = monthNo;
		if(MonthNumber == 12)
		{
			System.out.println("day: " + day + " month No: " + monthNo + " day No: " + n);
		}
	}
	//implement Update 
	@Override
	public void Update()
	{
		if(this.leapday)
		{
			if(CalendarManager.isLeap(CalendarManager.getYearNumber()))
			{
				this.setVisible(true);
			}
			else
			{
				this.setVisible(false);
				return;
			}
		}
		Day[][]  month = CalendarManager.getYear();
		updateLookAndFeel(month[MonthNumber][MemberOfMonth]);
	}
	@Override
	public void Update(Category[] cats)
	{
		if(this.leapday)
		{
			if(CalendarManager.isLeap(CalendarManager.getYearNumber()))
			{
				this.setVisible(true);
			}
			else
			{
				this.setVisible(false);
				return;
			}
		}
		Day[][]  month = CalendarManager.getYear();
		updateLookAndFeel(month[MonthNumber][MemberOfMonth], cats);
	}
	
}
